<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Create Article</title>
    </h:head>
    <h:body>
        <h:form id="articleFormCreation" prependId="false" >
            <h:panelGrid id="displayArt"> 
                <h:selectOneRadio id="createStatus" value="#{articleBean.selectedArticle.status}" required="true">
                    <f:selectItem id="st1"   itemLabel="Draft" itemValue="Draft" />
                    <f:selectItem id="st2"   itemLabel="Published" itemValue="Published" />
                </h:selectOneRadio>
                <p:message for="createStatus"/>
                <hr></hr>
                <h:outputLabel for="createTitle" value="Article Title(*):"/>
                <p:inputText value="#{articleBean.selectedArticle.title}" id="createTitle" required="true"/>
                <p:message for="createTitle"/>
                <hr></hr>
                <p:editor value="#{articleBean.selectedArticle.articleBody}" id="createArticleBody" width="400" height="200" required="true"/>
                <p:message for="createArticleBody"/>
                <hr></hr>
                <h:panelGrid id="displayTagDate" columns="2">
                    <h:outputLabel for="createDate" value="Publication Date:"/>
                    <p:inputText value="#{articleBean.selectedArticle.date}" id="createDate" readonly="true" required="true">
                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                    </p:inputText>
                    <h:outputLabel for="createTags" value="Tags:"/>
                    <p:inputText value="#{articleBean.tags}" id="createTags" required="true"/>
                    <p:message for="createTags"/>
                    <br></br>
                </h:panelGrid>
                <p:commandButton value="Save Article" action="#{articleBean.persistArticle()}" update="displayArt"></p:commandButton>       
            </h:panelGrid> 
        </h:form>
    </h:body>
</html>